﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using StripeOne.ShortenUrl.Database;
using System.Runtime.Serialization;

namespace StripeOne.ShortenUrl.Model
{
    public class ShortenModel
    {
        public int Id { get; set; }
        public DateTime InsertDate { get; set; }
        public string OriginalUrl { get; set; }
        public int Clicks { get; set; }
        public string Code { get; set; }
        public int UserId { get; set; }

        public ShortenModel()
        {
            this.InsertDate = DateTime.Now;
        }

        public ShortenModel(ShortenUrls shorteUrls)
        {
            this.Id = shorteUrls.Id;
            this.InsertDate = shorteUrls.InsertDate;
            this.OriginalUrl = shorteUrls.OriginalUrl;
            this.Clicks = shorteUrls.ShortenClicks.Count;
            this.Code = shorteUrls.ShortUrlCode;
            this.UserId = shorteUrls.UserId.Value;
        }
    }
}
